package com.id.supaclean.ktx
import com.id.supaclean.MyApplication.Companion.appContext

fun Float.toFixed(num: Int): Float = try {
    String.format("%.${num}f", this).toFloat()
} catch (e: Throwable) {
    this.toInt().toFloat()
}

val Float.dp: Float
    get() = appContext.resources.displayMetrics.density * this